package top.toptimus.dto.dbSync;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.toptimus.util.ValueUtil;

import java.util.Map;

/**
 * 设计点DTO
 *
 * @author gaoyu
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class DesignDTO {
    private static final Logger logger = LoggerFactory.getLogger(DesignDTO.class);
    private int SYS_STYLE_ID;
    private String ITEM_CD;
    private String ITEM_VALUE;
    private String OPTION_VALUE;

    public DesignDTO(Map<String, Object> stringObjectMap) {
        try {
            this.SYS_STYLE_ID = ValueUtil.IntNullValue(stringObjectMap.get("SYS_STYLE_ID").toString());
            this.ITEM_CD = stringObjectMap.containsKey("ITEM_CD") ? stringObjectMap.get("ITEM_CD").toString() : "";
            this.ITEM_VALUE = stringObjectMap.containsKey("ITEM_VALUE") ? stringObjectMap.get("ITEM_VALUE").toString() : "";
            this.OPTION_VALUE = stringObjectMap.containsKey("OPTION_VALUE") && (stringObjectMap.get("OPTION_VALUE") != null) ? stringObjectMap.get("OPTION_VALUE").toString() : "";
        } catch (Exception e) {
            logger.error("stringObjectMap:" + JSON.toJSONString(stringObjectMap));
            e.printStackTrace();
        }
    }
}
